<template>
  <div class="app-container">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="200px" class="demo-ruleForm">

      <el-form-item label="开启测试渠道" prop="record_unknown_brand">
        <el-switch v-model="ruleForm.test_channel" @change="handleChange"></el-switch>
        <span class="zs">开启测试渠道 </span>
      </el-form-item>

      <el-form-item label="记录未知厂商" prop="record_unknown_brand">
        <el-switch v-model="ruleForm.record_unknown_brand" @change="handleChange"></el-switch>
        <span class="zs">记录未知厂商 </span>
      </el-form-item>

      <el-form-item label="vivo检测链接参数日志开关" prop="vivo_detection_log">
        <el-switch v-model="ruleForm.vivo_detection_log" @change="handleChange"></el-switch>
        <span class="zs">vivo检测链接参数日志开关 </span>
      </el-form-item>

      <el-form-item label="oppo检测链接参数日志开关" prop="oppo_detection_log">
        <el-switch v-model="ruleForm.oppo_detection_log" @change="handleChange"></el-switch>
        <span class="zs">oppo检测链接参数日志开关 </span>
      </el-form-item>

      <el-form-item label="tx检测链接参数日志开关" prop="tx_detection_log">
        <el-switch v-model="ruleForm.tx_detection_log" @change="handleChange"></el-switch>
        <span class="zs">tx检测链接参数日志开关 </span>
      </el-form-item>

      <el-form-item label="小米检测链接参数日志开关" prop="tx_detection_log">
        <el-switch v-model="ruleForm.xiaomi_detection_log" @change="handleChange"></el-switch>
        <span class="zs">小米检测链接参数日志开关 </span>
      </el-form-item>

      <el-form-item label="巨量检测链接参数日志开关" prop="tx_detection_log">
        <el-switch v-model="ruleForm.jl_detection_log" @change="handleChange"></el-switch>
        <span class="zs">巨量检测链接参数日志开关 </span>
      </el-form-item>

      <el-form-item label="vivo回传成功日志开关" prop="vivo_back_log">
        <el-switch v-model="ruleForm.vivo_back_log" @change="handleChange"></el-switch>
        <span class="zs">vivo回传成功日志开关 </span>
      </el-form-item>

      <el-form-item label="oppo回传成功日志开关" prop="oppo_back_log">
        <el-switch v-model="ruleForm.oppo_back_log" @change="handleChange"></el-switch>
        <span class="zs">oppo回传成功日志开关 </span>
      </el-form-item>

      <el-form-item label="小米回传成功日志开关" prop="oppo_back_log">
        <el-switch v-model="ruleForm.xiaomi_back_log" @change="handleChange"></el-switch>
        <span class="zs">小米回传成功日志开关 </span>
      </el-form-item>

      <el-form-item label="tx回传成功日志开关" prop="tx_back_log">
        <el-switch v-model="ruleForm.tx_back_log" @change="handleChange"></el-switch>
        <span class="zs">tx回传成功日志开关 </span>
      </el-form-item>

      <el-form-item label="巨量回传成功日志开关" prop="jl_back_log">
        <el-switch v-model="ruleForm.jl_back_log" @change="handleChange"></el-switch>
        <span class="zs">巨量回传成功日志开关 </span>
      </el-form-item>

    </el-form>
  </div>
</template>

<script>
import { getWebSetting, updateWebSetting} from "@/api/adv_admin/config.js";
import waves from "@/directive/waves"; // waves directive
import { Message } from "element-ui";
export default {
  name: "web",
  directives: { waves },
  data() {
    return {
      ruleForm: {},
      rules: {

      }
    };
  },
  created() {
    this.getconfig()
  },
  methods: {
    getconfig(){
      getWebSetting().then(res => {
        if (res.STATUS == 200){
          this.ruleForm = res.DATA.list
        }
      })
    },
    handleChange(){
      updateWebSetting({config: JSON.stringify(this.ruleForm)}).then(res => {
        if(res.STATUS == 200){
          Message.success('修改成功')
        }
      })
    }
  },
};
</script>

<style scoped>
.zs{
  padding-left: 20px;
  color: #878787;
}
.box {
  margin: 200px auto;
  width: 1000px;
}
.selectBox {
  width: 100%;
  text-align: center;
}
.btnBox {
  margin-top: 30px;
  text-align: center;
}
.linkMargin {
  margin-right: 20px;
}
@media (max-width: 550px) {
  .box {
    margin: 200px auto;
    width: 320px;
  }
  .filter-item {
    margin-top: 10px;
  }
  .linkMargin {
    margin-right: 0px;
  }
}
</style>
